<template>
  <view>
    <view class="header">
      <image src="./back.png" mode="" @click="back"></image>
      <span>圈子</span>
      <span></span>
    </view>
    <view class="kb"></view>
    <view class="title">
      <view class="title-center">
        <view :class="stynum == 1 ? 'one' : 'two'" @click="stynum = 1">
          <span>全部</span>
          <view class="hen"></view>
        </view>
        <view :class="stynum == 2 ? 'one' : 'two'" @click="stynum = 2">
          <span>我的圈子</span>
          <view class="hen"></view>
        </view>
      </view>
    </view>
    <!-- 全部 -->
    <view class="contain-all" v-if="stynum == 1">
      <view
        class="contain-all-person"
        v-for="item in data"
        :key="item.id"
        @click="gotoxq"
      >
        <view class="ciecleInfo">
          <image class="contain-all-person-img" :src="item.img" mode=""></image>
          <view class="contain-all-person-xq">
            <span class="contain-all-person-xq-one">{{ item.name }}</span>
            <span class="contain-all-person-xq-two">{{ item.num }} 成员</span>
          </view>
        </view>
        <view class="status">
          <view class="nojoin" v-if="item.join == 1">加入</view>
          <view class="join" v-if="item.join == 0">已加入</view>
        </view>
      </view>
    </view>
    <!-- 我的圈子 -->
    <view class="contain-all" v-if="stynum == 2">
      <view
        class="contain-all-person"
        v-for="item in data2"
        :key="item.id"
        @click="gotoxq"
      >
        <view class="ciecleInfo">
          <image class="contain-all-person-img" :src="item.img" mode=""></image>
          <view class="contain-all-person-xq">
            <span class="contain-all-person-xq-one">{{ item.name }}</span>
            <span class="contain-all-person-xq-two">{{ item.num }} 成员</span>
          </view>
        </view></view
      >
    </view>
    <!-- 我的圈子 -->
  </view>
</template>

<script>
export default {
  data() {
    return {
      stynum: 1,
      data: [
        {
          id: 1,
          name: "跑步爱好者",
          join: 1,
          num: "5211",
          img: require("./bg.png"),
        },
        {
          id: 2,
          name: "跑步爱好者",
          join: 0,
          num: "5212",
          img: require("./bg.png"),
        },
        {
          id: 3,
          name: "跑步爱好者",
          join: 1,
          num: "5213",
          img: require("./bg.png"),
        },
      ],
      data2: [
        { id: 1, name: "da跑步爱好者", num: "5211", img: require("./bg.png") },
        { id: 2, name: "da跑步爱好者", num: "5212", img: require("./bg.png") },
        { id: 3, name: "dad跑步爱好者", num: "5213", img: require("./bg.png") },
      ],
    };
  },
  methods: {
    back() {
      uni.navigateBack({
        delta: 1,
      });
    },
    gotoxq() {
      uni.navigateTo({
        url: "/pages/community/circledetails/circledetails",
      });
    },
  },
};
</script>

<style lang="scss">
.header {
  width: 750rpx;
  height: 160rpx;
  position: fixed;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 20rpx;
  font-size: 36rpx;
  z-index: 10;
  background-color: #ffffff;
  text-align: center;
  image {
    width: 30rpx;
    height: 48rpx;
  }
}
.kb {
  width: 750rpx;
  height: 200rpx;
}
.title {
  width: 100%;
  height: 150rpx;
  // border: 1px solid red;

  .title-center {
    margin: 0 auto;
    width: 450rpx;
    height: 100rpx;
    // border: 1px solid red;
    display: flex;
    align-items: center;
    justify-content: space-between;
    .one {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      flex-direction: column;
      font-size: 28rpx;
      color: #f4333c;
      span {
        width: 100%;
        margin-bottom: 20rpx;
      }
      .hen {
        width: 42rpx;
        height: 6rpx;
        background-color: #f4333c;
      }
    }
    .two {
      font-size: 28rpx;
    }
  }
}
.contain-all {
  margin: 0 auto;
  width: 720rpx;
  height: 3000rpx;
  .contain-all-person {
	padding: 10rpx 20rpx;
    border-bottom: 1rpx solid #d2d2d2;
    display: flex;
	justify-content: space-between;
	align-items: center;
    margin-bottom: 10rpx;
    .ciecleInfo {
      display: flex;
      .contain-all-person-img {
        width: 96rpx;
        height: 96rpx;
        margin-right: 20rpx;
        border-radius: 10rpx;
      }
      .contain-all-person-xq {
        width: 300rpx;
        height: 100rpx;
        display: flex;
        align-items: flex-start;
        justify-content: flex-start;
        flex-wrap: wrap;
        span {
          width: 100%;
        }
        .contain-all-person-xq-one {
          color: #181818;
          font-size: 28rpx;
        }
        .contain-all-person-xq-two {
          color: #9d9d9d;
          font-size: 20rpx;
        }
      }
    }
    .status {
      .nojoin {
        width: 120rpx;
        height: 60rpx;
        text-align: center;
        line-height: 60rpx;
        border: 2rpx solid #f4333c;
        border-radius: 30rpx;
        color: #f4333c;
      }
      .join {
        width: 120rpx;
        height: 60rpx;
        text-align: center;
        line-height: 60rpx;
        color: #f4333c;
      }
    }
  }
}
</style>
